const goodsModel = require('../models/goods.js')

exports.getGoods = async (req, res, next) => {
    try {
        const goods = await goodsModel.getGoods(req.query)
        res.status(200).json(goods)
    } catch (err) {
        next(err)
    }
}

exports.getGoodsById = async (req, res, next) => {
    try {
        const {id} = req.params
        const goods = await goodsModel.getGoodsById(id)
        res.status(200).json(goods)
    } catch (err) {
        next(err)
    }
}

exports.getGoodsByIds = async (req, res, next) => {
    try {
        const { ids } = req.params
        const goods = await goodsModel.getGoodsByIds(ids)
        res.status(200).json(goods)
    } catch (err) {
        next(err)
    }
}